package com.ruoyi.redtea.dualprevent.service.impl;

import com.ruoyi.redtea.dualprevent.domain.entity.TrainAnalyseUnitRiskPoint;
import com.ruoyi.redtea.dualprevent.mapper.TrainAnalyseUnitRiskPointMapper;
import com.ruoyi.redtea.dualprevent.service.TrainAnalyseUnitRiskPointService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author lgp
* @description 针对表【train_analyse_unit_risk_point(分析单元（对象）的风险点)】的数据库操作Service实现
* @createDate 2024-05-15 13:29:33
*/
@Service
public class TrainAnalyseUnitRiskPointServiceImpl implements TrainAnalyseUnitRiskPointService{

    @Resource
    private TrainAnalyseUnitRiskPointMapper riskPointMapper;

    @Override
    public List<TrainAnalyseUnitRiskPoint> queryList() {
        return riskPointMapper.selectList();
    }

    @Override
    public boolean insertRiskPoint(Integer analyseUnitId,String name) {
        TrainAnalyseUnitRiskPoint trainAnalyseUnitRiskPoint = new TrainAnalyseUnitRiskPoint();
        trainAnalyseUnitRiskPoint.setAnalyseUnitId(analyseUnitId);
        trainAnalyseUnitRiskPoint.setRiskPointName(name);
        riskPointMapper.setDelFlag(trainAnalyseUnitRiskPoint);
        return riskPointMapper.insert(trainAnalyseUnitRiskPoint)==1;
    }

    @Override
    public boolean updateRiskPoint(Integer id, String name) {
        TrainAnalyseUnitRiskPoint trainAnalyseUnitRiskPoint = new TrainAnalyseUnitRiskPoint();
        trainAnalyseUnitRiskPoint.setId(id);
        trainAnalyseUnitRiskPoint.setRiskPointName(name);
        return riskPointMapper.updateById(trainAnalyseUnitRiskPoint)==1;
    }

    @Override
    public boolean delRiskPoint(Integer id) {
        TrainAnalyseUnitRiskPoint trainAnalyseUnitRiskPoint = new TrainAnalyseUnitRiskPoint();
        trainAnalyseUnitRiskPoint.setId(id);
        return riskPointMapper.deleteById(trainAnalyseUnitRiskPoint)==1;
    }
}




